<template>
    <view class="loding_view h-full" v-if="loading">
        <view class="loding_show h-full" :style="{ backgroundColor }">
            <view class="loding_wrapper">
                <image :src="src" class="loding_gif" />
            </view>
        </view>
    </view>
</template>

<script setup>
	
	import { ref, watch } from 'vue'
	import { imgPath } from '@/common/config.js'
	
	const props = defineProps({
		status: {
			type: Boolean,
			default: false
		},
		backgroundColor: {
			type: String,
			default: 'transparent'
		},
		src: {
			type: String,
			default: `${imgPath}gifs/loading.gif`
		}
	})
	
	const loading = ref(props.status)
	watch(() => props.status, status => loading.value = status)
	
</script>

<style lang="scss" scoped>
    .loding_view {
        .loding_show {          
            background-color: #fff;
            opacity: 0.8;
            //
            display: flex;
            align-items: center;
            justify-content: center;
            .loding_wrapper {
                width: 100%;
                height: 300rpx;
                display: flex;
                align-items: center;
                justify-content: center;
                .loding_gif {
                    width: 80rpx;
                    height: 80rpx;
                }
            }
        }
    }
</style>
